/*
 * @Description: 
 * @Autor: 田力源
 * @Date: 2023-02-17 16:00:02
 * @LastEditors: 田力源
 * @LastEditTime: 2023-02-18 10:14:50
 */
import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', {
    state: () => {
        return {
            isLogin: false,
            userInfo: {
                username: '',
                password: '',
                nickname: '',
                id: '',
                image: '',
                status: 0
            },
            userlike: {
                invIds: [],
                comIds: [],
                artIds: [],
                artcomIds: []
            }
        }
    },
    actions: {
        changeLogin(val: boolean) {
            this.isLogin = val
        },
        setUserInfo(val: any) {
            this.userInfo = val;
        },
        setUserLike(obj: any) {
            this.userlike.invIds = obj.invIds ? obj.invIds : [];
            this.userlike.comIds = obj.comIds ? obj.comIds : [];
            this.userlike.artIds = obj.artIds ? obj.artIds : [];
            this.userlike.artcomIds = obj.artcomIds ? obj.artcomIds : [];
        }
    },
})